package com.project.controller.manager;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.OrderBean;
import com.project.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@RequestMapping("manager/order")
public class ManagerController {

    @Autowired
    private IOrderService service;
    @RequestMapping("findByItem")
    public IPage<OrderBean> findByItem(String status, LocalDate startDate, LocalDate endDate, int pageNo){
        if ("不限".equals(status)){
            status = null;
        }
        return service.findByItem(status, startDate, endDate, pageNo);
    }
    @RequestMapping("findById")
    public OrderBean findById(int id){
        return service.findById(id);
    }
    @RequestMapping("updateStatus")
    public String updateStatus(Integer id,String status){
        service.updateStatus(id,status);
        return "ok";
    }
}
